home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / office german / PROPLUS.WW / PROPLSWW.CAB / AUTHOR2STRING.XSL < prev    next >
Extensible Markup Language  |  2006-07-09  |  31KB  |  806 lines

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  3. xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
  4.     <xsl:output method="xml" encoding="us-ascii"/>
  5.     <xsl:template match="b:NameList">
  6.     <xsl:if test="string-length(/*/b:Locals/b:DefaultLCID)=0">
  7.       <b:DisplayAuthor>
  8.             <xsl:for-each select="b:Person">
  9.                 <xsl:if test="string-length(b:Last) > 0">
  10.                     <xsl:value-of select="b:Last"/>
  11.                 </xsl:if>
  12.                 <xsl:if test="string-length(b:First) > 0">
  13.                     <xsl:text>, </xsl:text>
  14.                     <xsl:value-of select="b:First"/>
  15.                 </xsl:if>
  16.                 <xsl:if test="string-length(b:Middle) > 0">
  17.                     <xsl:text> </xsl:text>
  18.                     <xsl:value-of select="b:Middle"/>
  19.                 </xsl:if>
  20.                 <xsl:if test="(string-length(b:First) > 0 or string-length(b:Middle) > 0 or string-length(b:Last) > 0) and (count(../b:Person) > position())">
  21.                     <xsl:text>; </xsl:text>
  22.                 </xsl:if>
  23.             </xsl:for-each>
  24.       </b:DisplayAuthor>
  25.     </xsl:if>
  26.     </xsl:template>
  27.  
  28.   <xsl:template match="/b:Sources">
  29.     <b:Sources>
  30.       <xsl:apply-templates/>
  31.     </b:Sources>
  32.   </xsl:template>
  33.  
  34.   <xsl:template match="b:Source">
  35.     <b:Source>
  36.       <xsl:variable name="_MostImportantAuthorLocalName">
  37.         
  38.         <xsl:call-template name="MainContributors"/>
  39.       </xsl:variable>
  40.  
  41.       <xsl:variable name="MostImportantAuthorLocalName" select ="concat('b:', $_MostImportantAuthorLocalName)"/>
  42.  
  43.       <b:Tag>
  44.         <xsl:value-of select="b:Tag"/>
  45.       </b:Tag>
  46.       <xsl:variable name="displayAuthor">
  47.         <xsl:call-template name="formatMainAuthorLfmSku">
  48.           <xsl:with-param name="who" select ="$MostImportantAuthorLocalName"/>
  49.         </xsl:call-template>
  50.       </xsl:variable>
  51.       <xsl:variable name="displayTitle">
  52.         
  53.         <xsl:if test="string-length(b:Title)>0">
  54.           <xsl:value-of select="b:Title"/>
  55.         </xsl:if>
  56.         
  57.         <xsl:if test="string-length(b:Title)=0">
  58.           <xsl:choose>
  59.             <xsl:when test="b:SourceType='Book' or
  60.                                 b:SourceType='JournalArticle' or
  61.                                 b:SourceType='ConferenceProceedings' or
  62.                                 b:SourceType='Report' or
  63.                                 b:SourceType='Performance' or
  64.                                 b:SourceType='Film' or
  65.                                 b:SourceType='Patent' or
  66.                                 b:SourceType='Case'">
  67.  
  68.               <xsl:value-of select="b:ShortTitle"/>
  69.             </xsl:when>
  70.  
  71.             <xsl:when test="b:SourceType='BookSection'">
  72.               <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  73.               <xsl:variable name="bookTitle" select="b:BookTitle"/>
  74.  
  75.               <xsl:choose>
  76.                 <xsl:when test="string-length($shortTitle)>0">
  77.                   <xsl:value-of select="$shortTitle"/>
  78.                 </xsl:when>
  79.                 <xsl:when test="string-length($bookTitle)>0">
  80.                   <xsl:value-of select="$bookTitle"/>
  81.                 </xsl:when>
  82.               </xsl:choose>
  83.  
  84.             </xsl:when>
  85.  
  86.             <xsl:when test="b:SourceType='ArticleInAPeriodical'">
  87.               <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  88.               <xsl:variable name="periodicalTitle" select="b:PeriodicalTitle"/>
  89.  
  90.               <xsl:choose>
  91.                 <xsl:when test="string-length($shortTitle)>0">
  92.                   <xsl:value-of select="$shortTitle"/>
  93.                 </xsl:when>
  94.                 <xsl:when test="string-length($periodicalTitle)>0">
  95.                   <xsl:value-of select="$periodicalTitle"/>
  96.                 </xsl:when>
  97.               </xsl:choose>
  98.             </xsl:when>
  99.  
  100.             <xsl:when test="b:SourceType='InternetSite' or
  101.                                 b:SourceType='DocumentFromInternetSite'">
  102.               <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  103.               <xsl:variable name="internetSiteTitle" select="b:InternetSiteTitle"/>
  104.  
  105.               <xsl:choose>
  106.                 <xsl:when test="string-length($shortTitle)>0">
  107.                   <xsl:value-of select="$shortTitle"/>
  108.                 </xsl:when>
  109.                 <xsl:when test="string-length($internetSiteTitle)>0">
  110.                   <xsl:value-of select="$internetSiteTitle"/>
  111.                 </xsl:when>
  112.               </xsl:choose>
  113.             </xsl:when>
  114.  
  115.             <xsl:when test="b:SourceType='ElectronicSource' or
  116.                                 b:SourceType='Art' or
  117.                                 b:SourceType='Misc'">
  118.               <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  119.               <xsl:variable name="publicationTitle" select="b:PublicationTitle"/>
  120.  
  121.               <xsl:choose>
  122.                 <xsl:when test="string-length($shortTitle)>0">
  123.                   <xsl:value-of select="$shortTitle"/>
  124.                 </xsl:when>
  125.                 <xsl:when test="string-length($publicationTitle)>0">
  126.                   <xsl:value-of select="$publicationTitle"/>
  127.                 </xsl:when>
  128.               </xsl:choose>
  129.             </xsl:when>
  130.  
  131.             <xsl:when test="b:SourceType='SoundRecording'">
  132.               <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  133.               <xsl:variable name="albumTitle" select="b:AlbumTitle"/>
  134.  
  135.               <xsl:choose>
  136.                 <xsl:when test="string-length($shortTitle)>0">
  137.                   <xsl:value-of select="$shortTitle"/>
  138.                 </xsl:when>
  139.                 <xsl:when test="string-length($albumTitle)>0">
  140.                   <xsl:value-of select="$albumTitle"/>
  141.                 </xsl:when>
  142.               </xsl:choose>
  143.             </xsl:when>
  144.  
  145.             <xsl:when test="b:SourceType='Interview'">
  146.               <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  147.               
  148.               <xsl:variable name="broadcastTitle" select="b:BroadcastTitle"/>
  149.               
  150.               <xsl:choose>
  151.                 <xsl:when test="string-length($shortTitle)>0">
  152.                   <xsl:value-of select="$shortTitle"/>
  153.                 </xsl:when>
  154.                 
  155.                 <xsl:when test="string-length($broadcastTitle)>0">
  156.                   <xsl:value-of select="$broadcastTitle"/>
  157.                 </xsl:when>
  158.                 
  159.               </xsl:choose>
  160.             </xsl:when>
  161.  
  162.           </xsl:choose>
  163.         </xsl:if>
  164.       </xsl:variable>
  165.       <b:Author>
  166.           <b:Author>
  167.               <xsl:copy-of select="b:Author/*[local-name()=$_MostImportantAuthorLocalName]/*" />
  168.           </b:Author>
  169.       </b:Author>
  170.       <b:DisplayYear>
  171.         <xsl:if test="string-length(b:Year)>0">
  172.           <xsl:value-of select="b:Year"/>
  173.         </xsl:if>
  174.       </b:DisplayYear>
  175.       
  176.       <b:DisplayAuthor>
  177.           <xsl:value-of select="$displayAuthor"/>
  178.       </b:DisplayAuthor>
  179.       <b:DisplayTitle>
  180.           <xsl:value-of select="$displayTitle"/>
  181.       </b:DisplayTitle>
  182.       <b:SortKey>
  183.           <xsl:if test="string-length($displayAuthor) > 0">
  184.           <xsl:value-of select="$displayAuthor"/>
  185.           </xsl:if>
  186.           <xsl:if test="string-length($displayAuthor) = 0">
  187.           <xsl:value-of select="b:Tag"/>
  188.           </xsl:if>
  189.           <xsl:if test="string-length($displayTitle) > 0 or string-length(b:Year) > 0">
  190.               <xsl:value-of select="' '"/>
  191.             <xsl:value-of select="$displayTitle"/>
  192.  
  193.               <xsl:if test="string-length(b:Year) > 0">
  194.                   <xsl:value-of select="'!'"/>
  195.                   <xsl:value-of select="b:Year"/>
  196.               </xsl:if>
  197.           </xsl:if>
  198.       </b:SortKey>
  199.     </b:Source>
  200.   </xsl:template>
  201.  
  202.   <xsl:template name="MainContributors">
  203.     <xsl:choose>
  204.       <xsl:when test="./b:SourceType='Book'">
  205.         <xsl:choose>
  206.           <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  207.           <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  208.           <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  209.         </xsl:choose>
  210.       </xsl:when>
  211.  
  212.       <xsl:when test="./b:SourceType='BookSection'">
  213.         <xsl:choose>
  214.           <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  215.           <xsl:when test="string-length(./b:Author/b:BookAuthor)>0">BookAuthor</xsl:when>
  216.           <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  217.           <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  218.         </xsl:choose>
  219.       </xsl:when>
  220.  
  221.       <xsl:when test="./b:SourceType='JournalArticle'">
  222.         <xsl:choose>
  223.           <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  224.           <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  225.         </xsl:choose>
  226.       </xsl:when>
  227.  
  228.       <xsl:when test="./b:SourceType='ArticleInAPeriodical'">
  229.         <xsl:choose>
  230.           <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  231.           <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  232.         </xsl:choose>
  233.       </xsl:when>
  234.  
  235.       <xsl:when test="./b:SourceType='ConferenceProceedings'">
  236.         <xsl:choose>
  237.           <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  238.           <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  239.         </xsl:choose>
  240.       </xsl:when>
  241.  
  242.       <xsl:when test="./b:SourceType='Report'">
  243.         <xsl:choose>
  244.           <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  245.         </xsl:choose>
  246.       </xsl:when>
  247.  
  248.       <xsl:when test="./b:SourceType='SoundRecording'">
  249.         <xsl:choose>
  250.           <xsl:when test="string-length(./b:Author/b:Performer)>0">Performer</xsl:when>
  251.           <xsl:when test="string-length(./b:Author/b:Artist)>0">Artist</xsl:when>
  252.           <xsl:when test="string-length(./b:Author/b:Composer)>0">Composer</xsl:when>
  253.           <xsl:when test="string-length(./b:Author/b:Conductor)>0">Conductor</xsl:when>
  254.           <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  255.         </xsl:choose>
  256.       </xsl:when>
  257.  
  258.       <xsl:when test="./b:SourceType='Performance'">
  259.         <xsl:choose>
  260.           <xsl:when test="string-length(./b:Author/b:Writer)>0">Writer</xsl:when>
  261.           <xsl:when test="string-length(./b:Author/b:Performer)>0">Performer</xsl:when>
  262.           <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  263.           <xsl:when test="string-length(./b:Author/b:Director)>0">Director</xsl:when>
  264.         </xsl:choose>
  265.       </xsl:when>
  266.  
  267.       <xsl:when test="./b:SourceType='Art'">
  268.         <xsl:choose>
  269.           <xsl:when test="string-length(./b:Author/b:Artist)>0">Artist</xsl:when>
  270.         </xsl:choose>
  271.       </xsl:when>
  272.  
  273.       <xsl:when test="./b:SourceType='DocumentFromInternetSite'">
  274.         <xsl:choose>
  275.           <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  276.           <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  277.           <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  278.         </xsl:choose>
  279.       </xsl:when>
  280.  
  281.       <xsl:when test="./b:SourceType='InternetSite'">
  282.         <xsl:choose>
  283.           <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  284.           <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  285.           <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  286.         </xsl:choose>
  287.       </xsl:when>
  288.  
  289.       <xsl:when test="./b:SourceType='Film'">
  290.         <xsl:choose>
  291.           <xsl:when test="string-length(./b:Author/b:Writer)>0">Writer</xsl:when>
  292.           <xsl:when test="string-length(./b:Author/b:Performer)>0">Performer</xsl:when>
  293.           <xsl:when test="string-length(./b:Author/b:Director)>0">Director</xsl:when>
  294.           <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  295.         </xsl:choose>
  296.       </xsl:when>
  297.  
  298.       <xsl:when test="./b:SourceType='Interview'">
  299.         <xsl:choose>
  300.           <xsl:when test="string-length(./b:Author/b:Interviewee)>0">Interviewee</xsl:when>
  301.           <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  302.           <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  303.           <xsl:when test="string-length(./b:Author/b:Interviewer)>0">Interviewer</xsl:when>
  304.           <xsl:when test="string-length(./b:Author/b:Compiler)>0">Compiler</xsl:when>
  305.         </xsl:choose>
  306.       </xsl:when>
  307.  
  308.       <xsl:when test="./b:SourceType='Patent'">
  309.         <xsl:choose>
  310.           <xsl:when test="string-length(./b:Author/b:Inventor)>0">Inventor</xsl:when>
  311.           <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  312.           <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  313.         </xsl:choose>
  314.       </xsl:when>
  315.  
  316.       <xsl:when test="./b:SourceType='ElectronicSource'">
  317.         <xsl:choose>
  318.           <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  319.           <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  320.           <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  321.           <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  322.         </xsl:choose>
  323.       </xsl:when>
  324.  
  325.       <xsl:when test="./b:SourceType='Case'">
  326.         <xsl:choose>
  327.           <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  328.           <xsl:when test="string-length(./b:Author/b:Counsel)>0">Counsel</xsl:when>
  329.         </xsl:choose>
  330.       </xsl:when>
  331.  
  332.       <xsl:when test="./b:SourceType='Misc'">
  333.         <xsl:choose>
  334.           <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  335.           <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  336.           <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  337.           <xsl:when test="string-length(./b:Author/b:Compiler)>0">Compiler</xsl:when>
  338.         </xsl:choose>
  339.       </xsl:when>
  340.     </xsl:choose>
  341.   </xsl:template>
  342.  
  343.   <xsl:template name="formatMainAuthorLfmSku">
  344.     <xsl:param name="who"/>
  345.     <xsl:for-each select="b:Author/*[name()=$who]">
  346.       <xsl:call-template name="formatPersonsAuthor"/>
  347.     </xsl:for-each>
  348.   </xsl:template>
  349.  
  350.   <xsl:template name="formatIntervieweeLfmSku">
  351.     <xsl:for-each select="b:Author/b:Interviewee">
  352.       <xsl:call-template name="formatPersonsAuthor"/>
  353.     </xsl:for-each>
  354.   </xsl:template>
  355.  
  356.   <xsl:template name="formatInterviewerLfmSku">
  357.     <xsl:for-each select="b:Author/b:Interviewer">
  358.       <xsl:call-template name="formatPersonsAuthor"/>
  359.     </xsl:for-each>
  360.   </xsl:template>
  361.  
  362.   <xsl:template name="formatPersonsAuthor">
  363.     <xsl:if test="string-length(b:Corporate)=0">
  364.         <xsl:for-each select="b:NameList/b:Person">
  365.           <xsl:if test="3 >= position()">
  366.             <xsl:call-template name="formatMainAuthor"/>
  367.           </xsl:if>
  368.           <xsl:call-template name="formatPersonSeperatorMain"/>
  369.         </xsl:for-each>
  370.     </xsl:if>
  371.     <xsl:if test="string-length(b:Corporate)>0">
  372.       <xsl:value-of select="b:Corporate"/>
  373.     </xsl:if>
  374.   </xsl:template>
  375.  
  376.   <xsl:template name="formatMainAuthor">
  377.     <xsl:call-template name="formatNameCore">
  378.       <xsl:with-param name="FML">
  379.         <xsl:call-template name="templ_prop_Authors_FML"/>
  380.       </xsl:with-param>
  381.       <xsl:with-param name="FM">
  382.         <xsl:call-template name="templ_prop_Authors_FM"/>
  383.       </xsl:with-param>
  384.       <xsl:with-param name="ML">
  385.         <xsl:call-template name="templ_prop_Authors_ML"/>
  386.       </xsl:with-param>
  387.       <xsl:with-param name="FL">
  388.         <xsl:call-template name="templ_prop_Authors_FL"/>
  389.       </xsl:with-param>
  390.       <xsl:with-param name="upperLast">no</xsl:with-param>
  391.       <xsl:with-param name="withDot">yes</xsl:with-param>
  392.  
  393.     </xsl:call-template>
  394.   </xsl:template>
  395.  
  396.   <xsl:template name="formatPersonSeperatorMain">
  397.     <xsl:param name="isLast"/>
  398.  
  399.     <xsl:choose>
  400.       <xsl:when test="3 >= count(../b:Person) and position() = count(../b:Person) - 1">
  401.         <xsl:call-template name="templ_prop_AuthorsSeparator"/>
  402.         <xsl:if test="string-length($isLast)=0 or $isLast=true()">
  403.           <xsl:call-template name="templ_prop_Space"/>
  404.         </xsl:if>
  405.       </xsl:when>
  406.       <xsl:when test="3 > position() and position() != count(../b:Person)">
  407.         <xsl:call-template name="templ_prop_AuthorsSeparator"/>
  408.       </xsl:when>
  409.       <xsl:when test="count(../b:Person) > 3 and position() = count(../b:Person)">
  410.         <xsl:call-template name="templ_prop_AuthorsSeparator"/>
  411.         <xsl:call-template name="templ_str_AndOthersUnCap"/>
  412.       </xsl:when>
  413.       <xsl:when test="position()>3">
  414.       </xsl:when>
  415.     </xsl:choose>
  416.   </xsl:template>
  417.  
  418.   <xsl:template name="formatNameCore">
  419.     <xsl:param name="FML"/>
  420.     <xsl:param name="FM"/>
  421.     <xsl:param name="ML"/>
  422.     <xsl:param name="FL"/>
  423.     <xsl:param name="upperLast"/>
  424.     <xsl:param name="withDot"/>
  425.  
  426.     <xsl:variable name="first">
  427.       <xsl:call-template name="handleSpaces">
  428.         <xsl:with-param name="field" select="b:First"/>
  429.       </xsl:call-template>
  430.     </xsl:variable>
  431.  
  432.     <xsl:variable name="middle">
  433.       <xsl:call-template name="handleSpaces">
  434.         <xsl:with-param name="field" select="b:Middle"/>
  435.       </xsl:call-template>
  436.     </xsl:variable>
  437.  
  438.     <xsl:variable name="last">
  439.       <xsl:call-template name="handleSpaces">
  440.         <xsl:with-param name="field" select="b:Last"/>
  441.       </xsl:call-template>
  442.     </xsl:variable>
  443.  
  444.     <xsl:variable name="format">
  445.       <xsl:choose>
  446.         <xsl:when test="string-length($first) = 0 and string-length($middle) = 0 and string-length($last) = 0 ">
  447.         </xsl:when>
  448.         <xsl:when test="string-length($first) = 0 and string-length($middle) = 0 and string-length($last) != 0 ">
  449.           <xsl:text>%L</xsl:text>
  450.         </xsl:when>
  451.         <xsl:when test="string-length($first) = 0 and string-length($middle) != 0 and string-length($last) = 0 ">
  452.           <xsl:text>%M</xsl:text>
  453.         </xsl:when>
  454.         <xsl:when test="string-length($first) = 0 and string-length($middle) != 0 and string-length($last) != 0 ">
  455.           <xsl:value-of select="$ML"/>
  456.         </xsl:when>
  457.         <xsl:when test="string-length($first) != 0 and string-length($middle) = 0 and string-length($last) = 0 ">
  458.           <xsl:text>%F</xsl:text>
  459.         </xsl:when>
  460.         <xsl:when test="string-length($first) != 0 and string-length($middle) = 0 and string-length($last) != 0 ">
  461.           <xsl:value-of select="$FL"/>
  462.         </xsl:when>
  463.         <xsl:when test="string-length($first) != 0 and string-length($middle) != 0 and string-length($last) = 0 ">
  464.           <xsl:value-of select="$FM"/>
  465.         </xsl:when>
  466.         <xsl:when test="string-length($first) != 0 and string-length($middle) != 0 and string-length($last) != 0 ">
  467.           <xsl:value-of select="$FML"/>
  468.         </xsl:when>
  469.       </xsl:choose>
  470.     </xsl:variable>
  471.  
  472.     <xsl:call-template name="StringFormatName">
  473.       <xsl:with-param name="format" select="$format"/>
  474.       <xsl:with-param name="upperLast" select="$upperLast"/>
  475.       <xsl:with-param name="withDot" select="$withDot"/>
  476.     </xsl:call-template>
  477.  
  478.   </xsl:template>
  479.  
  480.   <xsl:template name="StringFormatName">
  481.     <xsl:param name="format" />
  482.     <xsl:param name="withDot" />
  483.     <xsl:param name="upperLast"/>
  484.  
  485.     <xsl:variable name="prop_EndChars">
  486.       <xsl:call-template name="templ_prop_EndChars"/>
  487.     </xsl:variable>
  488.  
  489.     <xsl:choose>
  490.       <xsl:when test="$format = ''"></xsl:when>
  491.       <xsl:when test="substring($format, 1, 2) = '%%'">
  492.         <xsl:text>%</xsl:text>
  493.         <xsl:call-template name="StringFormatName">
  494.           <xsl:with-param name="format" select="substring($format, 3)" />
  495.           <xsl:with-param name="withDot" select="$withDot" />
  496.           <xsl:with-param name="upperLast" select="$upperLast" />
  497.         </xsl:call-template>
  498.  
  499.         <xsl:if test="string-length($format)=2 and withDot = 'yes' and not(contains($prop_EndChars, '%'))">
  500.           <xsl:call-template name="templ_prop_Dot"/>
  501.         </xsl:if>
  502.       </xsl:when>
  503.       <xsl:when test="substring($format, 1, 1) = '%'">
  504.         <xsl:variable name="what" select="substring($format, 2, 1)" />
  505.  
  506.         <xsl:choose>
  507.           <xsl:when test="(what = 'l' or what = 'L') and upperLast = 'yes'">
  508.             <span style='text-transform: uppercase;'>
  509.               <xsl:call-template name="formatNameOneItem">
  510.                 <xsl:with-param name="format" select="$what"/>
  511.               </xsl:call-template>
  512.             </span>
  513.           </xsl:when>
  514.           <xsl:otherwise>
  515.             <xsl:call-template name="formatNameOneItem">
  516.               <xsl:with-param name="format" select="$what"/>
  517.             </xsl:call-template>
  518.           </xsl:otherwise>
  519.         </xsl:choose>
  520.         <xsl:call-template name="StringFormatName">
  521.           <xsl:with-param name="format" select="substring($format, 3)" />
  522.           <xsl:with-param name="withDot" select="$withDot" />
  523.           <xsl:with-param name="upperLast" select="$upperLast" />
  524.         </xsl:call-template>
  525.         <xsl:if test="string-length($format)=2 and withDot='yes'">
  526.           <xsl:variable name="temp2">
  527.             <xsl:call-template name="handleSpaces">
  528.               <xsl:with-param name="field">
  529.                 <xsl:call-template name="formatNameOneItem">
  530.                   <xsl:with-param name="format" select="$what"/>
  531.                 </xsl:call-template>
  532.               </xsl:with-param>
  533.             </xsl:call-template>
  534.           </xsl:variable>
  535.           <xsl:variable name="lastChar">
  536.             <xsl:value-of select="substring($temp2, string-length($temp2))"/>
  537.           </xsl:variable>
  538.           <xsl:if test="not(contains($prop_EndChars, $lastChar))">
  539.             <xsl:call-template name="templ_prop_Dot"/>
  540.           </xsl:if>
  541.         </xsl:if>
  542.       </xsl:when>
  543.       <xsl:otherwise>
  544.         <xsl:value-of select="substring($format, 1, 1)" />
  545.         <xsl:call-template name="StringFormatName">
  546.           <xsl:with-param name="format" select="substring($format, 2)" />
  547.           <xsl:with-param name="withDot" select="$withDot" />
  548.           <xsl:with-param name="upperLast" select="$upperLast" />
  549.         </xsl:call-template>
  550.         <xsl:if test="string-length($format)=1">
  551.           <xsl:if test="withDot = 'yes' and not(contains($prop_EndChars, $format))">
  552.             <xsl:call-template name="templ_prop_Dot"/>
  553.           </xsl:if>
  554.         </xsl:if>
  555.       </xsl:otherwise>
  556.     </xsl:choose>
  557.   </xsl:template>
  558.  
  559.   <xsl:template name="formatNameOneItem">
  560.     <xsl:param name="format"/>
  561.  
  562.     <xsl:choose>
  563.       <xsl:when test="$format = 'F'">
  564.         <xsl:value-of select="b:First"/>
  565.       </xsl:when>
  566.       <xsl:when test="$format = 'L'">
  567.         <xsl:value-of select="b:Last"/>
  568.       </xsl:when>
  569.       <xsl:when test="$format = 'M'">
  570.         <xsl:value-of select="b:Middle"/>
  571.       </xsl:when>
  572.       <xsl:when test="$format = 'f'">
  573.         <xsl:call-template name="formatNameInitial">
  574.           <xsl:with-param name="name" select="b:First"/>
  575.         </xsl:call-template>
  576.       </xsl:when>
  577.       <xsl:when test="$format = 'm'">
  578.         <xsl:call-template name="formatNameInitial">
  579.           <xsl:with-param name="name" select="b:Middle"/>
  580.         </xsl:call-template>
  581.       </xsl:when>
  582.       <xsl:when test="$format = 'l'">
  583.         <xsl:call-template name="formatNameInitial">
  584.           <xsl:with-param name="name" select="b:Last"/>
  585.         </xsl:call-template>
  586.       </xsl:when>
  587.     </xsl:choose>
  588.  
  589.   </xsl:template>
  590.  
  591.   <xsl:template name="formatNameInitial">
  592.     <xsl:param name="name"/>
  593.     <xsl:variable name="temp">
  594.       <xsl:call-template name="handleSpaces">
  595.         <xsl:with-param name="field" select="$name"/>
  596.       </xsl:call-template>
  597.     </xsl:variable>
  598.  
  599.     <xsl:variable name="prop_APA_Hyphens">
  600.       <xsl:call-template name="templ_prop_Hyphens"/>
  601.     </xsl:variable>
  602.  
  603.     <xsl:if test="string-length($temp)>0">
  604.  
  605.       <xsl:variable name="tempWithoutSpaces">
  606.         <xsl:value-of select="translate($temp, '  ', '')"/>
  607.         
  608.       </xsl:variable>
  609.  
  610.       <xsl:if test="not(contains($prop_APA_Hyphens, substring($tempWithoutSpaces, 1, 1)))">
  611.         <xsl:value-of select="substring($tempWithoutSpaces, 1, 1)"/>
  612.         <xsl:call-template name="templ_prop_DotInitial"/>
  613.       </xsl:if>
  614.  
  615.       <xsl:call-template name="handleHyphens">
  616.         <xsl:with-param name="name" select="$tempWithoutSpaces"/>
  617.       </xsl:call-template>
  618.     </xsl:if>
  619.   </xsl:template>
  620.  
  621.   <xsl:template name="handleHyphens">
  622.     <xsl:param name="name"/>
  623.  
  624.     <xsl:variable name="prop_APA_Hyphens">
  625.       <xsl:call-template name="templ_prop_Hyphens"/>
  626.     </xsl:variable>
  627.  
  628.     <xsl:if test="string-length($name)>=2">
  629.       <xsl:choose>
  630.         <xsl:when test="contains($prop_APA_Hyphens, substring($name, 1, 1))">
  631.           <xsl:value-of select="substring($name, 1, 2)"/>
  632.           <xsl:call-template name="templ_prop_DotInitial"/>
  633.  
  634.           <xsl:call-template name="handleHyphens">
  635.             <xsl:with-param name="name" select="substring($name, 3)"/>
  636.           </xsl:call-template>
  637.         </xsl:when>
  638.  
  639.         <xsl:otherwise>
  640.           <xsl:call-template name="handleHyphens">
  641.             <xsl:with-param name="name" select="substring($name, 2)"/>
  642.           </xsl:call-template>
  643.         </xsl:otherwise>
  644.       </xsl:choose>
  645.  
  646.     </xsl:if>
  647.  
  648.   </xsl:template>
  649.  
  650.   <xsl:template name="handleSpaces">
  651.     <xsl:param name="field"/>
  652.  
  653.     <xsl:variable name="prop_NormalizeSpace">
  654.       <xsl:call-template name="templ_prop_NormalizeSpace"/>
  655.     </xsl:variable>
  656.  
  657.     <xsl:choose>
  658.       <xsl:when test="$prop_NormalizeSpace='yes'">
  659.         <xsl:value-of select="normalize-space($field)"/>
  660.       </xsl:when>
  661.       <xsl:otherwise>
  662.         <xsl:value-of select="$field"/>
  663.       </xsl:otherwise>
  664.     </xsl:choose>
  665.   </xsl:template>
  666.  
  667.   <xsl:template name="localLCID">
  668.     <xsl:value-of select="/*/b:Locals/b:DefaultLCID"/>
  669.   </xsl:template>
  670.  
  671.   
  672.   <xsl:template name="templ_prop_NormalizeSpace" >
  673.     <xsl:param name="LCID" />
  674.     <xsl:variable name="_LCID">
  675.       <xsl:call-template name="localLCID">
  676.         <xsl:with-param name="LCID" select="$LCID"/>
  677.       </xsl:call-template>
  678.     </xsl:variable>
  679.     <xsl:text>no</xsl:text>
  680.     
  681.   </xsl:template>
  682.  
  683.   
  684.   <xsl:template name="templ_prop_AuthorsSeparator" >
  685.     <xsl:param name="LCID" />
  686.     <xsl:variable name="_LCID">
  687.       <xsl:call-template name="localLCID">
  688.         <xsl:with-param name="LCID" select="$LCID"/>
  689.       </xsl:call-template>
  690.     </xsl:variable>
  691.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:AuthorsSeparator"/>
  692.   </xsl:template>
  693.  
  694.   
  695.   <xsl:template name="templ_prop_Space" >
  696.     <xsl:param name="LCID" />
  697.     <xsl:variable name="_LCID">
  698.       <xsl:call-template name="localLCID">
  699.         <xsl:with-param name="LCID" select="$LCID"/>
  700.       </xsl:call-template>
  701.     </xsl:variable>
  702.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:Space"/>
  703.   </xsl:template>
  704.  
  705.   
  706.   <xsl:template name="templ_str_AndOthersUnCap" >
  707.     <xsl:param name="LCID" />
  708.     <xsl:variable name="_LCID">
  709.       <xsl:call-template name="localLCID">
  710.         <xsl:with-param name="LCID" select="$LCID"/>
  711.       </xsl:call-template>
  712.     </xsl:variable>
  713.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Strings/b:AndOthersUnCap"/>
  714.   </xsl:template>
  715.  
  716.   
  717.   <xsl:template name="templ_prop_EndChars" >
  718.     <xsl:param name="LCID" />
  719.     <xsl:variable name="_LCID">
  720.       <xsl:call-template name="localLCID">
  721.         <xsl:with-param name="LCID" select="$LCID"/>
  722.       </xsl:call-template>
  723.     </xsl:variable>
  724.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:EndChars"/>
  725.   </xsl:template>
  726.  
  727.   
  728.   <xsl:template name="templ_prop_Dot" >
  729.     <xsl:param name="LCID" />
  730.     <xsl:variable name="_LCID">
  731.       <xsl:call-template name="localLCID">
  732.         <xsl:with-param name="LCID" select="$LCID"/>
  733.       </xsl:call-template>
  734.     </xsl:variable>
  735.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:Dot"/>
  736.   </xsl:template>
  737.  
  738.   
  739.   <xsl:template name="templ_prop_Authors_FML" >
  740.     <xsl:param name="LCID" />
  741.     <xsl:variable name="_LCID">
  742.       <xsl:call-template name="localLCID">
  743.         <xsl:with-param name="LCID" select="$LCID"/>
  744.       </xsl:call-template>
  745.     </xsl:variable>
  746.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:FML"/>
  747.   </xsl:template>
  748.  
  749.   
  750.   <xsl:template name="templ_prop_Authors_FM" >
  751.     <xsl:param name="LCID" />
  752.     <xsl:variable name="_LCID">
  753.       <xsl:call-template name="localLCID">
  754.         <xsl:with-param name="LCID" select="$LCID"/>
  755.       </xsl:call-template>
  756.     </xsl:variable>
  757.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:FM"/>
  758.   </xsl:template>
  759.  
  760.   
  761.   <xsl:template name="templ_prop_Authors_ML" >
  762.     <xsl:param name="LCID" />
  763.     <xsl:variable name="_LCID">
  764.       <xsl:call-template name="localLCID">
  765.         <xsl:with-param name="LCID" select="$LCID"/>
  766.       </xsl:call-template>
  767.     </xsl:variable>
  768.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:ML"/>
  769.   </xsl:template>
  770.  
  771.   
  772.   <xsl:template name="templ_prop_Authors_FL" >
  773.     <xsl:param name="LCID" />
  774.     <xsl:variable name="_LCID">
  775.       <xsl:call-template name="localLCID">
  776.         <xsl:with-param name="LCID" select="$LCID"/>
  777.       </xsl:call-template>
  778.     </xsl:variable>
  779.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:FL"/>
  780.   </xsl:template>
  781.  
  782.   
  783.   <xsl:template name="templ_prop_Hyphens" >
  784.     <xsl:param name="LCID" />
  785.     <xsl:variable name="_LCID">
  786.       <xsl:call-template name="localLCID">
  787.         <xsl:with-param name="LCID" select="$LCID"/>
  788.       </xsl:call-template>
  789.     </xsl:variable>
  790.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:Hyphens"/>
  791.   </xsl:template>
  792.  
  793.   
  794.   <xsl:template name="templ_prop_DotInitial" >
  795.     <xsl:param name="LCID" />
  796.     <xsl:variable name="_LCID">
  797.       <xsl:call-template name="localLCID">
  798.         <xsl:with-param name="LCID" select="$LCID"/>
  799.       </xsl:call-template>
  800.     </xsl:variable>
  801.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:DotInitial"/>
  802.   </xsl:template>
  803.  
  804. </xsl:stylesheet>
  805.  
  806.